//
//  ViewController.swift
//  颜色渐变动画
//
//  Created by app on 2017/4/12.
//  Copyright © 2017年 app. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
    
    var loginButton:UIButton!
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        loginButton = UIButton(frame: CGRect(x: 20, y: 230, width:view.frame.width - 40 , height: 50))
        loginButton.backgroundColor = UIColor.red
        loginButton.setTitle("我是按钮", for: .normal)
        loginButton.alpha = 0
        view.addSubview(loginButton)
        
        
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        UIView.beginAnimations(nil, context: nil)
        UIView.setAnimationDuration(4)
        loginButton.alpha = 1
        loginButton.transform = CGAffineTransform(scaleX: 0.7, y: 1.2)
        UIView.commitAnimations()
    }
    
}

